A RPM file consists of the lead, a RPM signature and a RPM header followed by a CPIO archive.
The lead is not used any more. All informations are obsolete or are duplicated in the RPM signature and RPM header. But the lead is used to recognize rpm files with the file command. See here to find out how the lead is organized.
The RPM signature and RPM header share the same datastructure. They consist of a header, a number of indexes and a store.
The header contains the number of indexes that follow the header and the size of the store.
Every index describes a bit of data stored in the store. It consist of a tag (see signature tags and header tags), a data type, an offset in the store and a count, describing the number of items stored as the described data type.
Allowed data types are:
type | count description |
---|---|
NULL | Number of nulls in the data field |
CHAR | Number of chars in the data field |
INT8 | Number of int8 in the data field |
INT16 | Number of int16 in the data field |
INT32 | Number of int32 in the data field |
INT64 | Number of int64 in the data field |
STRING | There can be only one string per entry. The String is terminated by a \0 character |
BIN | Number of bytes in the data field (as an binary array) |
STRING_ARRAY | Number of strings in the data field. All strings are terminated with a \0 character |
I18NSTRING | A string array that contains several entries in different locales. Every entry correspond with a locale defined at the same position as in the tag HEADERI18NTABLES in the RPM header |
unsigned char magic[4]; (4 byte) (ed ab ee db) unsigned char major, minor; (1 byte each) short type; (2 byte) short archnum; (2 byte) char name[66]; (66 byte) short osnum; (2 byte) short signature_type; (2 byte) char reserved[16]; (16 byte) =96 byte
unsigned char magic[3]; (3 byte) (8e ad e8) unsigned char version; (1 byte) char reserved[4]; (4 byte) int num_index; (4 byte) int num_data; (4 byte) =16 byte
int tag; (4 byte) int type; (4 byte) int offset; (4 byte) int count; (4 byte) =16 byte
TAG-Name | TAG-ID |
---|---|
HEADERSIGNATURES | 62 |
BADSHA1_1 | 264 |
BADSHA1_2 | 265 |
DSA | 267 |
RSA | 268 |
SHA1 | 269 |
SIZE | 1000 |
LEMD5_1 | 1001 |
PGP | 1002 |
LEMD5_2 | 1003 |
MD5 | 1004 |
GPG | 1005 |
PGP5 | 1006 |
PAYLOADSIZE | 1007 |
TAG-Name | TAG-ID |
---|---|
HEADERIMAGE | 61 |
HEADERSIGNATURES | 62 |
HEADERIMMUTABLE | 63 |
HEADERREGIONS | 64 |
HEADERI18NTABLE | 100 |
SIG_BASE | 256 |
SIGSIZE | 257 |
SIGLEMD5_1 | 258 |
SIGPGP | 259 |
SIGLEMD5_2 | 260 |
SIGMD5 | 261 |
SIGGPG | 262 |
SIGPGP5 | 263 |
BADSHA1_1 | 264 |
BADSHA1_2 | 265 |
PUBKEYS | 266 |
DSAHEADER | 267 |
RSAHEADER | 268 |
SHA1HEADER | 269 |
NAME | 1000 |
VERSION | 1001 |
RELEASE | 1002 |
SERIAL | 1003 |
SUMMARY | 1004 |
DESCRIPTION | 1005 |
BUILDTIME | 1006 |
BUILDHOST | 1007 |
INSTALLTIME | 1008 |
SIZE | 1009 |
DISTRIBUTION | 1010 |
VENDOR | 1011 |
GIF | 1012 |
XPM | 1013 |
COPYRIGHT | 1014 |
PACKAGER | 1015 |
GROUP | 1016 |
CHANGELOG | 1017 |
SOURCE | 1018 |
PATCH | 1019 |
URL | 1020 |
OS | 1021 |
ARCH | 1022 |
PREIN | 1023 |
POSTIN | 1024 |
PREUN | 1025 |
POSTUN | 1026 |
FILENAMES | 1027 |
FILESIZES | 1028 |
FILESTATES | 1029 |
FILEMODES | 1030 |
FILEUIDS | 1031 |
FILEGIDS | 1032 |
FILERDEVS | 1033 |
FILEMTIMES | 1034 |
FILEMD5S | 1035 |
FILELINKTOS | 1036 |
FILEFLAGS | 1037 |
ROOT | 1038 |
FILEUSERNAME | 1039 |
FILEGROUPNAME | 1040 |
EXCLUDE | 1041 |
EXCLUSIVE | 1042 |
ICON | 1043 |
SOURCERPM | 1044 |
FILEVERIFYFLAGS | 1045 |
ARCHIVESIZE | 1046 |
PROVIDES | 1047 |
REQUIREFLAGS | 1048 |
REQUIRENAME | 1049 |
REQUIREVERSION | 1050 |
NOSOURCE | 1051 |
NOPATCH | 1052 |
CONFLICTFLAGS | 1053 |
CONFLICTNAME | 1054 |
CONFLICTVERSION | 1055 |
DEFAULTPREFIX | 1056 |
BUILDROOT | 1057 |
INSTALLPREFIX | 1058 |
EXCLUDEARCH | 1059 |
EXCLUDEOS | 1060 |
EXCLUSIVEARCH | 1061 |
EXCLUSIVEOS | 1062 |
AUTOREQPROV | 1063 |
RPMVERSION | 1064 |
TRIGGERSCRIPT | 1065 |
TRIGGERNAME | 1066 |
TRIGGERVERSION | 1067 |
TRIGGERFLAGS | 1068 |
TRIGGERINDEX | 1069 |
VERIFYSCRIPT | 1079 |
CHANGELOGTIME | 1080 |
CHANGELOGNAME | 1081 |
CHANGELOGTEXT | 1082 |
BROKENMD5 | 1083 |
PREREQ | 1084 |
PREINPROG | 1085 |
POSTINPROG | 1086 |
PREUNPROG | 1087 |
POSTUNPROG | 1088 |
BUILDARCHS | 1089 |
OBSOLETENAME | 1090 |
VERIFYSCRIPTPROG | 1091 |
TRIGGERSCRIPTPROG | 1092 |
DOCDIR | 1093 |
COOKIE | 1094 |
FILEDEVICES | 1095 |
FILEINODES | 1096 |
FILELANGS | 1097 |
PREFIXES | 1098 |
INSTPREFIXES | 1099 |
TRIGGERIN | 1100 |
TRIGGERUN | 1101 |
TRIGGERPOSTUN | 1102 |
AUTOREQ | 1103 |
AUTOPROV | 1104 |
CAPABILITY | 1105 |
SOURCEPACKAGE | 1106 |
OLDORIGFILENAMES | 1107 |
BUILDPREREQ | 1108 |
BUILDREQUIRES | 1109 |
BUILDCONFLICTS | 1110 |
BUILDMACROS | 1111 |
PROVIDEFLAGS | 1112 |
PROVIDEVERSION | 1113 |
OBSOLETEFLAGS | 1114 |
OBSOLETEVERSION | 1115 |
DIRINDEXES | 1116 |
BASENAMES | 1117 |
DIRNAMES | 1118 |
ORIGDIRINDEXES | 1119 |
ORIGBASENAMES | 1120 |
ORIGDIRNAMES | 1121 |
OPTFLAGS | 1122 |
DISTURL | 1123 |
PAYLOADFORMAT | 1124 |
PAYLOADCOMPRESSOR | 1125 |
PAYLOADFLAGS | 1126 |
INSTALLCOLOR | 1127 |
INSTALLTID | 1128 |
REMOVETID | 1129 |
SHA1RHN | 1130 |
RHNPLATFORM | 1131 |
PLATFORM | 1132 |
PATCHESNAME | 1133 |
PATCHESFLAGS | 1134 |
PATCHESVERSION | 1135 |
CACHECTIME | 1136 |
CACHEPKGPATH | 1137 |
CACHEPKGSIZE | 1138 |
CACHEPKGMTIME | 1139 |
FILECOLORS | 1140 |
FILECLASS | 1141 |
CLASSDICT | 1142 |
FILEDEPENDSX | 1143 |
FILEDEPENDSN | 1144 |
DEPENDSDICT | 1145 |
SOURCEPKGID | 1146 |
For further informations on rpm see www.rpm.org. You can find there the book Maximum RPM and the source for rpm.